package com.tjian.fafa.user.module.courier.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.tjian.fafa.user.module.courier.bean.FriendMessageBean;

import java.util.List;

public class FriendMessageAdapter extends BaseAdapter
{

    private List<FriendMessageBean> allMessage;
    private LayoutInflater layoutInflater;
    private Context context;


    public FriendMessageAdapter(Context ctx, List<FriendMessageBean> allMessage)
    {
        // TODO Auto-generated constructor stub
        this.allMessage = allMessage;
        this.context = ctx;
        layoutInflater = LayoutInflater.from(ctx);
    }


    @Override
    public int getCount()
    {

        return allMessage.size();
    }

    @Override
    public Object getItem(int arg0)
    {

        return allMessage.get(arg0);
    }

    @Override
    public long getItemId(int arg0)
    {

        return arg0;
    }

    @SuppressWarnings("unused")
    @Override
    public View getView(int arg0, View arg1, ViewGroup arg2)
    {


        RelativeLayout layoutView = null;
        ViewHolder viewHolder = null;
        if (layoutView == null)
        {
        }
        else
        {
            viewHolder = (ViewHolder) layoutView.getTag();
        }

        FriendMessageBean bean = allMessage.get(arg0);
        viewHolder.tvName.setText(bean.getAccept_name());
        viewHolder.tvResultCode.setText(bean.getSend_code());
        viewHolder.tvTime.setText(bean.getSend_time());
        viewHolder.tvContent.setText(bean.getMessage_content());
        return layoutView;
    }

    static class ViewHolder
    {

        private TextView tvName;

        private TextView tvContent;

        private TextView tvTime;

        private TextView tvResultCode;


    }


}
